package com.czjtxy.extraTerm.controller.jobmodule;

import com.czjtxy.extraTerm.entity.DO.Tjob;
import com.czjtxy.extraTerm.server.JobService;
import com.czjtxy.extraTerm.serverImpl.JobServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

/**
 * @program: staff-house
 * @author: MingYi
 * @create: 2021/07/01 15:20
 */
@WebServlet(name = "JobServlet", value = "/JobServlet")
public class JobServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        JobService jobService = new JobServiceImpl();
        List<Tjob> tjobs = null;
        try {
            tjobs = jobService.getAll();
            req.setAttribute("tjobs", tjobs);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        req.getRequestDispatcher("job/job.jsp").forward(req, resp);
    }
}
